# 导包
import app
import requests
# 创建封装的类
class Employee:
    def __init__(self):
        self.url_emp = app.BASE_URL + "/api/sys/user"

    # 编写封装的类，查询员工列表
    def query_emp_list(self,headers):
        return requests.get(url=self.url_emp,
                            params="page=1&size=10",
                            headers=headers)

    # 添加员工
    def add_emp(self,headers,jsonData):
        return requests.post(url=self.url_emp,
                             hesders=headers,
                             json=jsonData)

    # 查询员工
    def query_emp(self,headers,emp_id):
        return requests.get(url=self.url_emp + "/" + emp_id,
                            headers=headers)

    # 封装修改员工
    def modify_emp(self,headers,jsonData,emp_id):
        return requests.put(url=self.url_emp + "/" + emp_id,
                            headers=headers,
                            json=jsonData)

    # 删除员工
    def delete_emp(self,headers,emp_id):
        return requests.delete(url=self.url_emp + "/" + emp_id,
                               headers=headers,)

